<html>
<head><meta charset="utf-8"><title>Optimizing away catch_unwind? · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Optimizing.20away.20catch_unwind.3F.html">Optimizing away catch_unwind?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207755290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Optimizing%20away%20catch_unwind%3F/near/207755290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Optimizing.20away.20catch_unwind.3F.html#207755290">(Aug 23 2020 at 04:15)</a>:</h4>
<p>Currently <code>catch_unwind(f)</code> generate A LOT OF CODE that can't be optimized away with lto=fat when it's impossible for f to unwind. Is it possible to optimize these away at the mir level?</p>



<a name="208075177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Optimizing%20away%20catch_unwind%3F/near/208075177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Optimizing.20away.20catch_unwind.3F.html#208075177">(Aug 26 2020 at 10:32)</a>:</h4>
<p>it could certainly be done. We'd need something like the endgame of <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20StatementKind.3A.3ACall.20to.20MIR.20compiler-team.23348">https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20StatementKind.3A.3ACall.20to.20MIR.20compiler-team.23348</a> first to distinguish function calls that can unwind from those that can't</p>



<a name="208075219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Optimizing%20away%20catch_unwind%3F/near/208075219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Optimizing.20away.20catch_unwind.3F.html#208075219">(Aug 26 2020 at 10:33)</a>:</h4>
<p>we may need an analysis similar to the inliner cycle detector so we can generate the "may panic" info on the fly</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>